﻿using BarrageGameAssistant.Core.Enums;
using System.Drawing;

namespace BarrageGameAssistant.Core.Model
{
    /// <summary>
    /// 场景匹配数据
    /// </summary>
    public class SceneMatchData
    {
        public string Id { get; set; } = Guid.NewGuid().ToString();

        /// <summary>
        /// 匹配方式 0 包含匹配 1 相似度匹配 2 OCR识别匹配
        /// </summary>
        public IdentifyMatchType MatchType { get; set; } = IdentifyMatchType.Contains;

        /// <summary>
        /// 识别前处理方式
        /// </summary>
        public PreProcessingModeType PreProcessingMode { get; set; } = PreProcessingModeType.None;

        /// <summary>
        /// 包含判断逻辑 0 包含 1不包含
        /// </summary>
        public int IncludeLogic { get; set; } = 0;

        /// <summary>
        /// 匹配阈值
        /// </summary>
        public double Threshold { get; set; } = 0.65f;

        /// <summary>
        /// 场景大小
        /// </summary>
        public Size SceneSize { get; set; }

        /// <summary>
        /// 场景图像实际大小
        /// </summary>
        public Size SceneImageSize { get; set; }

        /// <summary>
        /// Ocr匹配类型
        /// </summary>
        public OcrMatchType OcrMatchType { get; set; }

        /// <summary>
        /// Ocr匹配字符串
        /// </summary>
        public string OcrText { get; set; } = string.Empty;

        /// <summary>
        /// 待匹配图形边界
        /// </summary>
        public Rectangle Bounds { get; set; }

        public SceneMatchData()
        {
        }

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="matchType"></param>
        /// <param name="bounds"></param>
        public SceneMatchData(IdentifyMatchType matchType, Rectangle bounds)
        {
            this.MatchType = matchType;
            this.Bounds = bounds;
        }

        public override string ToString()
        {
            string logic = IncludeLogic == 0 ? "包含" : "不包含";
            return $"逻辑:{logic},阈值:{Threshold},边界:{Bounds}";
        }
    }
}
